package com.lysj.bhp.user.repository;

import com.lysj.bhp.investment.vo.DividendVo;
import com.lysj.bhp.user.domain.WalletEditLog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

public interface WalletEditLogRepository extends JpaRepository<WalletEditLog, Long>, JpaSpecificationExecutor {

    @Query("SELECT new com.lysj.bhp.investment.vo.DividendVo(a.walletType,a.amount,a.editDate,a.operation) from WalletEditLog a where  a.editDate >= ?1 AND a.editDate <= ?2 AND a.userId = ?3 AND a.walletType=?4 ORDER BY a.editDate DESC ")
    Page<DividendVo> findUserWalletEditRecord(Pageable page, Date begin_createTime, Date end_createTime, Long userId,Integer walletType);


    List<WalletEditLog> findByUserIdAndWalletTypeIn(Long userId,Integer[] typeIds);
}
